import { ipcMain } from "electron";
import type { UnzipFileArgs } from "@common/archives-file-types.ts";
import { getWindow } from "@elec/main/util/window-holder.ts";
import { UnzipTask } from "@elec/main/task/unzip-task.ts";

(() => {
  ipcMain.on("archives.unzip", async (event, param: UnzipFileArgs) => {
    UnzipTask.submit(param.id, param.archiveFile, param.outputDir, getWindow(event.sender.id));
  });
  ipcMain.on("archives.unzip.cancel", async (event, id: string) => {
    UnzipTask.cancel(id);
  });
})();
